package main

import "fmt"

type Address struct {
	Name  string
	Phone int
}

func main() {
	var userinfo = make(map[string]interface{})
	userinfo["username"] = "张三"
	userinfo["age"] = 20
	userinfo["hobby"] = []string{"睡觉", "吃饭"}
	fmt.Println(userinfo["age"])
	fmt.Println(userinfo["hobby"])
	// fmt.Println(userinfo["hobby"][1]) //interface  does not support indexing
	fmt.Println(userinfo["hobby"].([]string)[1]) // 吃饭 ==> 空接口不支持索引 或map子查询， 需要进行断言内容， 在获取值

	var address = Address{
		Name:  "张三",
		Phone: 123456,
	}
	userinfo["address"] = address
	fmt.Println(userinfo["address"])                // {张三 123456}
	fmt.Println(userinfo["address"].(Address).Name) // 张三
}
